package com.video.netty.send;

import com.qf.entity.ResultData;
import com.video.commons.sendaop.ISocketSend;
import com.video.commons.utils.TaskUtil;
import com.video.entity.Task;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 实时音乐,复制任务，复制一条任务，taskid不一样
 * {"id":"copyMusicTask","account":"admin","taskid":"146",
 * "taskname":"Region", "loopType":1, "volume":"8","mp3":["1.mp3","2.mp3","G.E.M.邓紫棋 - 喜欢你.mp3"] ,
 * "terminal":["1", "2", "3"]}
 */
@Component
public class TaskCopySend extends ISocketSend {

    @Override
    public Map<String, Object> sendMsg(Object... objs) {
        Task task = ((ResultData<Task>) objs[0]).getData();

        Map<String, Object> map = TaskUtil.task2Map(task);
        switch (task.getTaskt()){
            case 5:
                //实时音乐
                map.put("id", "playMusicTask");
                break;
            case 1:
                //定时音乐
                map.put("id", "addTask");
                break;
            case 3:
                //报警
                map.put("id", "addFireTask");
                break;
        }
        return map;
    }
}
